{extend name='main'}

{block name="button"}
<!--{if auth("add")}-->
<button data-open='{:url("add")}' data-title="添加通知" class='layui-btn layui-btn-sm layui-btn-primary'>添加通知</button>
<!--{/if}-->
<!--{if auth("remove")}-->
<a data-confirm="确定要永久删除这些通知吗？" data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除</a>
<!--{/if}-->
{/block}

{block name="content"}
<div class="layui-tab layui-tab-card think-bg-white">
    <div class="layui-tab-content think-box-shadow">
        <fieldset>
            <legend>条件搜索</legend>
            <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">用户账号</label>
                    <div class="layui-input-inline">
                        <input name="username" value="{:input('get.username')}" placeholder="请输入用户名" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">通知类型</label>
                    <div class="layui-input-inline">
                        <select class="layui-select" name="send_type">
                        {foreach $noticeType as $k=>$v}
                        {if input('get.send_type') eq $k.""}
                        <option selected value="{$k}">{$v}</option>
                        {else}
                        <option value="{$k}">{$v}</option>
                        {/if}
                        {/foreach}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">创建时间</label>
                    <div class="layui-input-inline">
                        <input data-date-range name="create_at" value="{:input('get.create_at')}" placeholder="请选择创建时间" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
                </div>
            </form>
        </fieldset>

        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th class='list-table-check-td think-checkbox'>
                    <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
                </th>
                <th class='text-left nowrap' width="180px">标题</th>
                <th class='text-left nowrap' width="180px">通知类型</th>
                <th class='text-left nowrap' width="150px">用户</th>
                <th class='text-left nowrap' width="150px">创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr data-dbclick>
                <td class='list-table-check-td think-checkbox'>
                    <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
                </td>
                <td class='text-left nowrap'>
                    {$vo.title}
                </td>
                <td class='text-left nowrap'>
                    {$noticeType[$vo.send_type]}
                </td>
                <td class='text-left nowrap'>
                    {$vo.users}
                </td>
                <td class='text-left nowrap'>
                    {$vo.create_at|format_datetime}
                </td>
                <td class='text-left nowrap'>
                    <!--{if auth("edit")}-->
                    <a data-dbclick class="layui-btn layui-btn-sm"  data-title="编辑" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
                    <!--{/if}-->
                    <!--{if auth("viewread")}-->
                    <a class="layui-btn layui-btn-sm layui-btn-primary"  data-title="查看已阅读通知用户" data-iframe='{:url("viewread")}?id={$vo.id}'>查看已阅读用户</a>
                    <!--{/if}-->
                    <!--{if auth("remove")}-->
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要永久删除此通知吗？" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
                    <!--{/if}-->
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>
{/block}

{block name="script"}
<script>form.render()</script>
{/block}
